﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WeaponEvalue.Logic;

namespace WeaponEvalue
{
    public partial class LogForm : Form
    {
        private readonly LogHelper loghelper;
        private Image shijiuImage = Image.FromFile("狮鹫.JPG");
        private Image shandianImage = Image.FromFile("闪电.JPG");

        public LogForm()
        {
            this.loghelper = new LogHelper();
            InitializeComponent();
        }

        private void logTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
           if(logTypeComboBox.Text=="狮鹫")
           {
               List<ThreeDimension> dimensions = loghelper.GetLog(LogType.SHIJIU);
               logUserControl.BackgroundImage = shijiuImage;
               logUserControl.UpperLeft=new Point(-59750,8450);
               logUserControl.BottomRight=new Point(3700,-55000);
               logUserControl.AddPointRange(dimensions);
           }
           if (logTypeComboBox.Text == "闪电")
           {
               List<ThreeDimension> dimensions = loghelper.GetLog(LogType.SHANDIAN);
               logUserControl.BackgroundImage = shandianImage;
               logUserControl.UpperLeft = new Point(-44500, 44400);
               logUserControl.BottomRight = new Point(40500, -45500);
               logUserControl.AddPointRange(dimensions);
           }
        }

        private void refreshButton_Click(object sender, EventArgs e)
        {
            if (logTypeComboBox.Text == "狮鹫")
            {
                List<ThreeDimension> dimensions = loghelper.GetLog(LogType.SHIJIU);
                logUserControl.BackgroundImage = shijiuImage;
                logUserControl.AddPointRange(dimensions);
            }
            if (logTypeComboBox.Text == "闪电")
            {
                List<ThreeDimension> dimensions = loghelper.GetLog(LogType.SHANDIAN);
                logUserControl.BackgroundImage = shandianImage;
                logUserControl.AddPointRange(dimensions);
            }
        }
    }
}